﻿namespace Chain.BLL
{
    using Chain.IDAL;
    using Chain.Model;
    using System;
    using System.Collections.Generic;
    using System.Data;

    public class SysShopAuthority
    {
        private readonly Chain.IDAL.SysShopAuthority dal = new Chain.IDAL.SysShopAuthority();

        public int Add(Chain.Model.SysShopAuthority model)
        {
            return this.dal.Add(model);
        }

        public List<Chain.Model.SysShopAuthority> DataTableToList(DataTable dt)
        {
            List<Chain.Model.SysShopAuthority> list = new List<Chain.Model.SysShopAuthority>();
            int count = dt.Rows.Count;
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Chain.Model.SysShopAuthority item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return list;
        }

        public bool Delete(int ShopAuthorityID)
        {
            return this.dal.Delete(ShopAuthorityID);
        }

        public bool DeleteList(string ShopAuthorityIDlist)
        {
            return this.dal.DeleteList(ShopAuthorityIDlist);
        }

        public bool Exists(int ShopAuthorityID)
        {
            return this.dal.Exists(ShopAuthorityID);
        }

        public DataSet GetAllList()
        {
            return this.GetList("");
        }

        public DataSet GetList(string strWhere)
        {
            return this.dal.GetList(strWhere);
        }

        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return this.dal.GetList(Top, strWhere, filedOrder);
        }

        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return this.dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }

        public int GetMaxId()
        {
            return this.dal.GetMaxId();
        }

        public Chain.Model.SysShopAuthority GetModel(int ShopAuthorityID)
        {
            return this.dal.GetModel(ShopAuthorityID);
        }

        public List<Chain.Model.SysShopAuthority> GetModelList(string strWhere)
        {
            DataSet list = this.dal.GetList(strWhere);
            return this.DataTableToList(list.Tables[0]);
        }

        public int GetRecordCount(string strWhere)
        {
            return this.dal.GetRecordCount(strWhere);
        }

        public DataSet GetShopAuthority(int ShopID)
        {
            return this.dal.GetShopAuthority(ShopID);
        }

        public bool Update(Chain.Model.SysShopAuthority model)
        {
            return this.dal.Update(model);
        }
    }
}

